package com.zxy.supplier_system.server.service

import com.zxy.supplier_system.server.controller.MarketsShoppingGuideController.MarketShoppingGuideResponse
import com.zxy.supplier_system.server.repository.MarketShoppingGuideRepository
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

@Service
class MarketShoppingGuideService(
    private val marketShoppingGuideRepository: MarketShoppingGuideRepository
) {

    @Transactional(readOnly = true)
    fun findAllByMarketId(i: Int): List<MarketShoppingGuideResponse> {
        return this.marketShoppingGuideRepository.findAllByMarketId(i).map {
            MarketShoppingGuideResponse(it.employee.id!!, it.employee.name, it.employee.phoneNumber)
        }
    }

}
